<?php
namespace app\madmin\controller;
use app\madmin\model\FunctionSmsModel;

/**
 * 短信控制器
 * @author  黄明杰 vx:HMJ125855
 * @version 20190101
 */
class FunctionSms extends PublicBase{

	# 短信列表方法
    public function showList(){
        $FunctionSms = new FunctionSmsModel;

        $Where = $this->getFormWhere();

        $Lists = $FunctionSms->mList($Where, '*', config('CNF_LISTPAGE'));

        return $this->fetch('FunctionSms/showList', [
            'Lists' => $Lists
        ]);
    }

    # 短信发送方法
    public function showSend(){
    	$FunctionSms = new FunctionSmsModel;

        if(request()->isPost()){
            $Param = input('post.');

            $Back = $FunctionSms->mAdd($Param);

            $this->ShowData($Back['code'], $Back['msgs'], $Back['urls']);
        }else{
            return $this->fetch('FunctionSms/showSend', [
                'Info'  => Null
            ]);
        }
    }

    # 短信重发方法
    public function showAnew(){
        if(request()->isPost()){
            $FunctionSms = new FunctionSmsModel;
 
            $ID = input('param.id');

            $Param = input('post.');

            $Back = $FunctionSms->mEdit(['member_id'=>$ID], $Param);

            $this->ShowData($Back['code'], $Back['msgs'], $Back['urls']);
        }
    }

    # 短信删除方法
    public function showDel(){
    	if(request()->isPost()){
            $FunctionSms = new FunctionSmsModel;

            $ID = input('post.id');

            $Back = $FunctionSms->mDel(['sms_id'=>$ID]);

            $this->ShowData($Back['code'], $Back['msgs']);
        }
    }

}